@use "sass:color";

// 主色调定义 - 深蓝色主题
$primary-dark: #0f172a;
$primary-blue: #1e40af;
$secondary-blue: #1e3a8a;
$light-blue: #3b82f6;
$dark-bg: #0c1a32;
$panel-bg: rgba(15, 23, 42, 0.826);
$border-color: rgba(74, 85, 104, 0.3);
$text-light: #e2e8f0;
$button-bg: #1e293b;
$button-hover: #334155;
$button-active: #2563eb;
$glow-color: rgba(59, 130, 246, 0.4);

// 功能色定义
$primary-color: #29b4f6;
$success-color: #1cbb4a;
$warning-color: #e0b728;
$danger-color: #fd0000;
$info-color: #aab8d3;

// 文本和背景色
$text-color: #e0f4ff;
$text-secondary: #94a3b8;
$text-muted: #64748b;
$label-color: #8ad0ff;
$background-dark: rgba(8, 35, 61, 0.6);
$background-light: rgba(27, 68, 105, 0.5);
$background-hover: rgba(30, 58, 138, 0.3);

// 边框和阴影
$border-radius: 12px;
$border-radius-small: 6px;
$border-radius-large: 16px;
$spacing: 8px;
$box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
$box-shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.4);
$box-shadow-glow: 0 0 15px rgba(59, 130, 246, 0.5);

// 过渡动画
$transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
$transition-fast: all 0.15s ease-in-out;
$transition-slow: all 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);

// 间距变量
$spacing-xs: $spacing * 0.5; // 4px
$spacing-sm: $spacing;      // 8px
$spacing-md: $spacing * 2;  // 16px
$spacing-lg: $spacing * 3;  // 24px
$spacing-xl: $spacing * 4;  // 32px
$spacing-xxl: $spacing * 6; // 48px

// 字体大小
$font-size-xs: 12px;
$font-size-sm: 14px;
$font-size-md: 16px;
$font-size-lg: 18px;
$font-size-xl: 20px;
$font-size-xxl: 24px;

// 高度变量
$height-xs: 24px;
$height-sm: 32px;
$height-md: 40px;
$height-lg: 48px;

// Z-index 层级
$z-dropdown: 1000;
$z-sticky: 1020;
$z-fixed: 1030;
$z-modal-backdrop: 1040;
$z-modal: 1050;
$z-popover: 1060;
$z-tooltip: 1070;

// 通用按钮样式
.btnClass {
    border-radius: $border-radius-small;
    padding: 0 $spacing-md;
    color: $primary-color;
    cursor: pointer;
    border: 1px solid rgba($primary-color, 0.5);
    height: $height-sm;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: $transition;
    font-size: $font-size-sm;
    width: auto;
    background: rgba($primary-color, 0.1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    z-index: 1;
    
    // 添加渐变效果
    &::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba($primary-color, 0.2), transparent);
        transition: $transition;
        z-index: -1;
    }
    
    &:hover::before {
        left: 100%;
    }
    
    // 文本样式
    span {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    // 图标样式
    i.iconfont {
        margin-right: $spacing-xs;
        font-size: $font-size-md;
        transition: $transition;
    }
    
    // 无文本按钮
    &.noText {
        text-align: center;
        padding: 0 $spacing-sm;
        i.iconfont {
            margin: 0 !important;
        }
    }
    
    // 小号按钮
    &.small {
        height: $height-xs;
        font-size: $font-size-xs;
        padding: 0 $spacing-sm;
    }
    
    // 大号按钮
    &.large {
        height: $height-lg;
        font-size: $font-size-md;
        padding: 0 $spacing-lg;
    }
    
    // 成功按钮
    &.success {
        border-color: rgba($success-color, 0.5);
        color: $success-color;
        background: rgba($success-color, 0.1);
        
        .iconfont {
            color: $success-color !important;
        }
        
        &::before {
            background: linear-gradient(90deg, transparent, rgba($success-color, 0.2), transparent);
        }
        
        &:hover {
            background-color: rgba($success-color, 0.3);
            color: #fff;
            box-shadow: 0 2px 12px rgba($success-color, 0.4);
            transform: translateY(-1px);
        }
    }
    
    // 危险按钮
    &.danger {
        border-color: rgba($danger-color, 0.5);
        color: $danger-color;
        background: rgba($danger-color, 0.1);
        
        .iconfont {
            color: $danger-color !important;
        }
        
        &::before {
            background: linear-gradient(90deg, transparent, rgba($danger-color, 0.2), transparent);
        }
        
        &:hover {
            background-color: rgba($danger-color, 0.3);
            color: #fff;
            box-shadow: 0 2px 12px rgba($danger-color, 0.4);
            transform: translateY(-1px);
        }
    }
    
    // 警告按钮
    &.warning {
        border-color: rgba($warning-color, 0.5);
        color: $warning-color;
        background: rgba($warning-color, 0.1);
        
        .iconfont {
            color: $warning-color !important;
        }
        
        &::before {
            background: linear-gradient(90deg, transparent, rgba($warning-color, 0.2), transparent);
        }
        
        &:hover {
            background-color: rgba($warning-color, 0.3);
            color: #fff;
            box-shadow: 0 2px 12px rgba($warning-color, 0.4);
            transform: translateY(-1px);
        }
    }
    
    // 信息按钮
    &.info {
        border-color: rgba($info-color, 0.5);
        color: $info-color;
        background: rgba($info-color, 0.1);
        
        .iconfont {
            color: $info-color !important;
        }
        
        &::before {
            background: linear-gradient(90deg, transparent, rgba($info-color, 0.2), transparent);
        }
        
        &:hover {
            background-color: rgba($info-color, 0.3);
            color: #fff;
            box-shadow: 0 2px 12px rgba($info-color, 0.4);
            transform: translateY(-1px);
        }
    }
    
    // 关闭按钮
    &.close {
        border-color: rgba($danger-color, 0.3);
        color: $danger-color;
        background: rgba($danger-color, 0.05);
        
        &:hover {
            background-color: rgba($danger-color, 0.2);
            color: $danger-color;
            box-shadow: 0 2px 12px rgba($danger-color, 0.3);
        }
    }
    
    // 默认悬停效果
    &:hover {
        background-color: rgba($primary-color, 0.3);
        color: #fff;
        box-shadow: 0 2px 12px rgba($primary-color, 0.4);
        transform: translateY(-1px);
        border-color: rgba($primary-color, 0.8);
    }
    
    // 点击效果
    &:active {
        transform: translateY(0);
        box-shadow: $box-shadow;
    }
    
    // 禁用状态
    &:disabled {
        opacity: 0.5;
        cursor: not-allowed;
        transform: none;
        box-shadow: none;
    }
    
    // 渐变按钮
    &.gradient {
        background: linear-gradient(135deg, $primary-color 0%, $light-blue 100%);
        color: white;
        border-color: transparent;
        
        &:hover {
            background: linear-gradient(135deg, $light-blue 0%, $primary-blue 100%);
            box-shadow: 0 4px 16px rgba($primary-color, 0.4);
        }
    }
    
    // 发光效果
    &.glow {
        box-shadow: 0 0 10px rgba($primary-color, 0.5);
        
        &:hover {
            box-shadow: 0 0 20px rgba($primary-color, 0.8);
        }
    }
}
// 对话框底部
.dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: $spacing-sm;
    padding: $spacing-md;
    border-top: 1px solid $border-color;
    margin-top: $spacing-md;
}

// 按钮组容器
.btnBox {
    display: flex;
    justify-content: flex-end;
    gap: $spacing-sm;
    padding: $spacing-sm 0;
    flex-wrap: wrap;
}

// 卡片通用样式
.card {
    background: $panel-bg;
    border-radius: $border-radius;
    border: 1px solid $border-color;
    box-shadow: $box-shadow;
    transition: $transition;
    overflow: hidden;
    
    &:hover {
        box-shadow: $box-shadow-hover;
        transform: translateY(-2px);
    }
    
    .card-header {
        padding: $spacing-md;
        border-bottom: 1px solid $border-color;
        font-weight: 600;
        font-size: $font-size-md;
        color: $text-color;
    }
    
    .card-body {
        padding: $spacing-md;
    }
    
    .card-footer {
        padding: $spacing-md;
        border-top: 1px solid $border-color;
    }
}

// 表单通用样式
.form-group {
    margin-bottom: $spacing-md;
    
    .form-label {
        display: block;
        margin-bottom: $spacing-xs;
        color: $label-color;
        font-size: $font-size-sm;
        font-weight: 500;
    }
    
    .form-control {
        width: 100%;
        padding: $spacing-sm $spacing-md;
        background: rgba($primary-dark, 0.6);
        border: 1px solid $border-color;
        border-radius: $border-radius-small;
        color: $text-color;
        font-size: $font-size-sm;
        transition: $transition;
        
        &:focus {
            outline: none;
            border-color: $primary-color;
            box-shadow: 0 0 0 2px rgba($primary-color, 0.2);
        }
        
        &::placeholder {
            color: $text-muted;
        }
    }
}

// 列表项样式
.list-item {
    padding: $spacing-md;
    border-bottom: 1px solid $border-color;
    transition: $transition;
    cursor: pointer;
    
    &:hover {
        background: $background-hover;
        transform: translateX(2px);
    }
    
    &:last-child {
        border-bottom: none;
    }
}

// 标签样式
.tag {
    display: inline-block;
    padding: 2px $spacing-sm;
    border-radius: $border-radius-small;
    font-size: $font-size-xs;
    font-weight: 500;
    line-height: 1.5;
    background: rgba($primary-color, 0.1);
    color: $primary-color;
    border: 1px solid rgba($primary-color, 0.3);
    transition: $transition;
    
    &:hover {
        transform: translateY(-1px);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
    
    &.success {
        background: rgba($success-color, 0.1);
        color: $success-color;
        border-color: rgba($success-color, 0.3);
    }
    
    &.warning {
        background: rgba($warning-color, 0.1);
        color: $warning-color;
        border-color: rgba($warning-color, 0.3);
    }
    
    &.danger {
        background: rgba($danger-color, 0.1);
        color: $danger-color;
        border-color: rgba($danger-color, 0.3);
    }
    
    &.info {
        background: rgba($info-color, 0.1);
        color: $info-color;
        border-color: rgba($info-color, 0.3);
    }
}

// 徽章样式
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    font-size: $font-size-xs;
    font-weight: 600;
    color: white;
    background: $danger-color;
    border-radius: 10px;
    border: none;
    transition: $transition;
    
    &.badge-primary { background: $primary-color; }
    &.badge-success { background: $success-color; }
    &.badge-warning { background: $warning-color; }
    &.badge-info { background: $info-color; }
    
    &.badge-pill { border-radius: 50%; }
    &.badge-lg { 
        min-width: 24px; 
        height: 24px; 
        font-size: $font-size-sm;
    }
}

// 进度条样式
.progress {
    width: 100%;
    height: 8px;
    background: $background-dark;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    
    .progress-bar {
        height: 100%;
        background: linear-gradient(90deg, $primary-color, $light-blue);
        border-radius: 4px;
        transition: width 0.6s ease;
        position: relative;
        overflow: hidden;
        
        &::after {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
            animation: progressStripes 1.5s infinite;
        }
        
        &.success { background: linear-gradient(90deg, $success-color, color.scale($success-color, $lightness: 10%)); }
        &.warning { background: linear-gradient(90deg, $warning-color, color.scale($warning-color, $lightness: 10%)); }
        &.danger { background: linear-gradient(90deg, $danger-color, color.scale($danger-color, $lightness: 10%)); }
        &.info { background: linear-gradient(90deg, $info-color, color.scale($info-color, $lightness: 10%)); }
    }
    
    &.progress-lg { height: 12px; }
    &.progress-sm { height: 6px; }
}

// 动画定义
@keyframes progressStripes {
    0% { left: -100%; }
    100% { left: 100%; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInUp {
    from { 
        opacity: 0; 
        transform: translateY(20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

@keyframes slideInRight {
    from { 
        opacity: 0; 
        transform: translateX(20px); 
    }
    to { 
        opacity: 1; 
        transform: translateX(0); 
    }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

// 卡片变体
.card {
    &.card-primary {
        border-color: rgba($primary-color, 0.5);
        .card-header {
            background: rgba($primary-color, 0.1);
            color: $primary-color;
        }
    }
    
    &.card-success {
        border-color: rgba($success-color, 0.5);
        .card-header {
            background: rgba($success-color, 0.1);
            color: $success-color;
        }
    }
    
    &.card-warning {
        border-color: rgba($warning-color, 0.5);
        .card-header {
            background: rgba($warning-color, 0.1);
            color: $warning-color;
        }
    }
    
    &.card-danger {
        border-color: rgba($danger-color, 0.5);
        .card-header {
            background: rgba($danger-color, 0.1);
            color: $danger-color;
        }
    }
    
    &.card-glass {
        background: rgba(15, 23, 42, 0.6);
        backdrop-filter: blur(10px);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    &.card-hover-lift {
        transition: transform 0.3s ease, box-shadow 0.3s ease;
        
        &:hover {
            transform: translateY(-4px);
            box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
        }
    }
}

// 滚动条样式增强
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba($primary-dark, 0.5);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: rgba($primary-color, 0.6);
    border-radius: 3px;
    transition: $transition;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba($primary-color, 0.8);
}

// 工具类
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-primary { color: $primary-color; }
.text-success { color: $success-color; }
.text-warning { color: $warning-color; }
.text-danger { color: $danger-color; }
.text-muted { color: $text-muted; }

.d-flex { display: flex; }
.d-block { display: block; }
.d-inline-block { display: inline-block; }
.d-none { display: none; }

.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }
.align-center { align-items: center; }
.flex-wrap { flex-wrap: wrap; }

.mt-xs { margin-top: $spacing-xs; }
.mt-sm { margin-top: $spacing-sm; }
.mt-md { margin-top: $spacing-md; }
.mt-lg { margin-top: $spacing-lg; }
.mt-xl { margin-top: $spacing-xl; }

.mb-xs { margin-bottom: $spacing-xs; }
.mb-sm { margin-bottom: $spacing-sm; }
.mb-md { margin-bottom: $spacing-md; }
.mb-lg { margin-bottom: $spacing-lg; }
.mb-xl { margin-bottom: $spacing-xl; }

.p-xs { padding: $spacing-xs; }
.p-sm { padding: $spacing-sm; }
.p-md { padding: $spacing-md; }
.p-lg { padding: $spacing-lg; }
.p-xl { padding: $spacing-xl; }

.rounded { border-radius: $border-radius-small; }
.rounded-lg { border-radius: $border-radius; }
.shadow { box-shadow: $box-shadow; }
.transition { transition: $transition; }

// 响应式断点
@media (max-width: 768px) {
    .layout_container {
        .layout_slider {
            width: 200px;
            
            &.fold {
                width: 50px;
            }
        }
        
        .layout_tabbar,
        .layout_main {
            width: calc(100% - 200px);
            left: 200px;
            
            &.fold {
                width: calc(100vw - 50px);
                left: 50px;
            }
        }
    }
}
